# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def errors_count(params)
    options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
    objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact
    objects.inject(0) {|sum, object| sum + object.errors.count }
  end
  
  def break_lines(string)
    string.gsub("\n","<br/>")
  end
end
